//
//  FunnyViewController.swift
//  DouYuZB
//
//  Created by 刘耀 on 2017/4/14.
//  Copyright © 2017年 深圳多诺信息科技有限公司. All rights reserved.
//

import UIKit

private let kTopMargin: CGFloat = 8

class FunnyViewController: BaseAnchorViewController {

    fileprivate lazy var funnyVM : FunnyViewModel = FunnyViewModel()
}

extension FunnyViewController {
    override func setupUI() {
        super.setupUI()
        
        //去掉区头
        let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
        layout.headerReferenceSize = CGSize.zero
        collectionView.contentInset = UIEdgeInsetsMake(kTopMargin, 0, 0, 0)
        
    }
}

// MARK: - 请求数据
extension FunnyViewController {
    override func loadData() {
        // 1.给父类中的ViewModel进行赋值
        baseVM = funnyVM
        
        // 2.请求数据
        funnyVM.loadFunnyData {
            // 2.1.刷新表格
            self.collectionView.reloadData()
            self.loadDataFinished()
        }
        
    }
}

extension FunnyViewController {
    
}
